var vConsole = new VConsole();
var _domain='http://demo.yeahyo.cn/test/qqbrowser/2018novel/authtest/';// 授权回调地址
var _auth_url='http://migmkt.qq.com/g/act/auth.html';//授权url
var _token='H8L9gvuv0XZWcMGRNBG9s/HGDuN8sN2x0SgOyuxUykmYfg7c4gu8HIyB4cJsU3L3';//授权token参数
var _cookie_name='tx_cookie2';
var _nickname = GetQueryString('nickname') ? GetQueryString('nickname') : $.cookie(_cookie_name) ? JSON.parse($.cookie(_cookie_name)) : false;	
getUserInfo();
function getUserInfo(){		   
	if(!_nickname){ 
		window.location.href=_auth_url+'?token='+_token+'&ref='+encodeURIComponent(_domain);
		return;	
	}
	$.cookie(_cookie_name,JSON.stringify(_nickname),{ expires: 365, path: '/' });
	alert(_nickname);
	console.log(_nickname);
	return;
}
function GetQueryString(key) {
    var url = window.location.search;    
    var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)");// 正则筛选地址栏   
    var result = url.substr(1).match(reg); // 匹配目标参数   
    return result ? decodeURIComponent(result[2]) : null;
}


